home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Macintosh Demo Applications CD
/
Apple-MacintoshDemoApplicationsCD-1.0-1992.iso
/
More Information
/
QuicKeys
/
For Programmers Only.sea
/
Pascal Examples
/
SampleX.p
< prev
next >
Wrap
Text File
|
1991-06-22
|
2KB
|
94 lines
(* $Workfile$ *)
(* $Revision$ *)
{ QuicKeys 2™ sample extension execution routine}
{ © 1990 CE Software, Inc. All rights reserved.}
{ For QuicKeys 2 Extension Sample source code you have a royalty-free right }
{ to include object code derived from this Sample source code in programs }
{ that you develop. You also have the right to use, distribute, and license }
{ such programs to third parties without payment of any further license fees }
{ to CE Software, Inc., so long as a copyright notice sufficient to protect }
{ your copyright for your software in the United States or any other country; }
{ is included in the graphic display of your software and on the labels }
{ affixed to the media on which your software is distributed. }
{ WHEN WHO WHAT}
{•••••}
{ 9/5 mkg created version for both MPW and Think Pascal }
{•••••}
unit SampleExtensionX;
interface
uses
{$ifc undefined THINK_PASCAL}
Memtypes, Quickdraw, OSIntf, ToolIntf, PackIntf, OSUtils,
{$endc}
extensions, SampleData;
{$D-}
{$R-}
procedure doExecute (wSelector: integer;
var myData: SampleDataRec;
var myQueue: ExecuteQueue;
wPeriodicType: integer);
implementation
procedure doExecute (wSelector: integer;
var myData: SampleDataRec;
var myQueue: ExecuteQueue;
wPeriodicType: integer);
var
hSicn: Handle;
ulNow: longint;
begin
case wSelector of
initX:
begin
{ fetch our SICN and move it into myQueue }
hSicn := GetResource('SICN', -14348);
if hSicn <> nil then
BlockMove(hSicn^, @myQueue.sicn, 32);
end;
regularX:
begin
{ time to do the action called for in our key }
if myData.lWaitTime <= 0 then
begin
SysBeep(1);
end
else
begin
{ need to wait a while before playing }
{ Save the time we're going to beep in the refcon, enable }
{ periodic calls, and exit. Periodic calls will do the rest. }
GetDateTime(ulNow);
myQueue.lRefCon := ulNow + myData.lWaitTime;
myQueue.flags := bor(myQueue.flags, PeriodicFlag);
end;
end;
periodicX:
begin
{ check for the right time to beep }
GetDateTime(ulNow);
if ulNow >= myQueue.lRefCon then
begin
myQueue.flags := band(myQueue.flags, bnot(PeriodicFlag));
SysBeep(1);
end;
end;
abortX:
; { nothing do do here }
end;
end;
end.